<?php
require_once "db.php";

$movie_name = db_escape($_POST['movie_name']);
$duration = db_escape($_POST['duration']);
$picture = db_escape($_POST['picture']);
$ppf = db_escape($_POST['ppf']);
$descr = db_escape($_POST['descr']);
$genre1 = db_escape($_POST['genre1']);
$genre2 = db_escape($_POST['genre2']);
$genre3 = db_escape($_POST['genre3']);

if ($ppf == 'current') {
	$ppf2 = '1';
}
else if ($ppf == 'upcoming') {
	$ppf2 = '2';
}
else if ($ppf == 'premiere') {
	$ppf2 = '4';
}

$query = "INSERT INTO movies (movie_name, duration, picture_url, m_genre1, m_genre2, m_genre3, past_present_future, description) VALUES ('$movie_name', '$duration', '$picture', '$genre1', '$genre2', '$genre3', '$ppf2', '$descr')";
$result = db_query($query);
echo 'You add a new movie, now make projections';
